﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlPages.ascx.cs"
    Inherits="UserControl_ControlPages" %>
<%@ Register Assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="DevExpress.Web.v9.2" Namespace="DevExpress.Web.ASPxPopupControl"
    TagPrefix="dxpc" %>


<script type="text/javascript" language="javascript">
    $("#<%= btnSave.ClientID %>").click(function () {
        if ($("#<%= txtPageName.ClientID %>").val().length > 0
            && $("#<%= txtUrl.ClientID %>").val().length > 0
        ) {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        }
    });


    $("#<%= btnSearch.ClientID %>").click(function () {
        $.blockUI({ css: {
            border: 'none',
            padding: '15px',
            backgroundColor: '#000',
            '-webkit-border-radius': '10px',
            '-moz-border-radius': '10px',
            opacity: .5,
            color: '#fff'
        }
        });
    });
</script>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="direct_container_right_titletop">
            <asp:Label ID="Label4" runat="server" Text="<%$ Resources:LanguageResource, PageManagement %>"></asp:Label>   
        </div>
        <hr />
        <!-- Button chuc nang-->
        <div class="direct_container_main">
            <asp:ImageButton ID="imgBtnAdd" CausesValidation="false" ImageUrl="~/Images/add.png"
                Width="32px" Height="32px" runat="server" OnClick="imgBtnAdd_Click" />                
            
        </div>
        <!-- End Button chuc nang-->
        <cc1:tabcontainer id="TabContainer1" runat="server" activetabindex="0" backcolor="#CCFFFF"
            font-names="Arial" width="100%">
                    <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="<%$ Resources:LanguageResource, InsertNewPage %>">
                        <ContentTemplate>
                        <!-- Content main-->
                        <div class="direct_container_main">
                            <div class="direct_container_form_right">
                                <table border="0" width="100%">
                                    <tr>
                                        <td colspan="2" align="center">
                                            <asp:Label ID="lblMsg" runat="server" Visible="False" BackColor="Silver" ForeColor="Blue"
                                                Font-Bold="True" Font-Italic="True"></asp:Label>
                                            <asp:Label ID="lblID" runat="server" Text="0" Visible="false"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" width="15%">
                                            <p class="direct_label">
                                                <asp:Label ID="Label3" runat="server" Text="<%$ Resources:LanguageResource, Menu %>"></asp:Label>  </p>
                                        </td>
                                        <td align="left">
                                            <asp:DropDownList ID="ddlMenu" runat="server">
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                
                                    <tr>
                                        <td align="right" width="15%">
                                            <p class="direct_label">
                                                <asp:Label ID="Label2" runat="server" Text="<%$ Resources:LanguageResource, Language %>"></asp:Label>  
                                            </p>
                                        </td>
                                        <td align="left">
                                            <asp:DropDownList ID="ddlLanguage" runat="server" AutoPostBack="True" 
                                                onselectedindexchanged="ddlLanguage_SelectedIndexChanged">
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" width="15%">
                                            <p class="direct_label">
                                                <asp:Label ID="Label1" runat="server" Text="<%$ Resources:LanguageResource, PageName %>"></asp:Label>  
                                            </p>
                                        </td>
                                        <td align="left">
                                                <asp:TextBox ID="txtPageName" CssClass="input_full" runat="server"></asp:TextBox>
                                                <asp:RequiredFieldValidator ControlToValidate="txtPageName" Display="None" ID="RequiredFieldValidator1"
                                                runat="server" ErrorMessage="<%$ Resources:LanguageResource, InvalidPageName %>"></asp:RequiredFieldValidator>
                                                <cc1:ValidatorCalloutExtender TargetControlID="RequiredFieldValidator1" ID="ValidatorCalloutExtender1"
                                                    runat="server" Enabled="True">
                                                </cc1:ValidatorCalloutExtender>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" width="15%">
                                            <p class="direct_label">
                                                Url   
                                            </p>
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtUrl" CssClass="input_full" runat="server"></asp:TextBox>
                                            <asp:RequiredFieldValidator ControlToValidate="txtUrl" Display="None" ID="RequiredFieldValidator2"
                                                runat="server" ErrorMessage="<%$ Resources:LanguageResource, InvalidUrl %>"></asp:RequiredFieldValidator>
                                            <cc1:ValidatorCalloutExtender TargetControlID="RequiredFieldValidator2" ID="ValidatorCalloutExtender2"
                                                runat="server" Enabled="True">
                                            </cc1:ValidatorCalloutExtender>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" width="15%">
                                            <p class="direct_label">
                                            
                                            </p>
                                        </td>
                                        <td align="left">
                                            <asp:Button ID="btnSave" runat="server" Text="<%$ Resources:LanguageResource, Save %>" onclick="btnSave_Click"/>
                                        </td>
                                    </tr>
                                
                        </table>
                            </div>
                        </div>
                        </ContentTemplate>
                    </cc1:TabPanel>
                    <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="<%$ Resources:LanguageResource, Search %>" TabIndex="1">
                        <ContentTemplate>
                        
                        <!-- Content main-->
                        <div class="direct_container_main">
                            <div class="direct_container_form_right">
                                <table border="0" width="100%">
                                    <tr>
                                        <td colspan="4">
                                            <p class="direct_legend">
                                                <asp:Label ID="Label5" runat="server" Text="<%$ Resources:LanguageResource, InputSearch %>"></asp:Label>  </p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 140px; text-align: right">
                                            <asp:Label ID="Label6" runat="server" Text="<%$ Resources:LanguageResource, Menu %>"></asp:Label>
                                        </td>
                                        <td style="width: 150px">
                                            <asp:DropDownList ID="ddlMenu2" runat="server" Width="150px" />
                                        </td>
                                        <td style="width: 130px; text-align: right">
                                       
                                            <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
                                       
                                        </td>
                                        <td style="text-align: left">
                                            <asp:Button ID="btnSearch" CssClass="direct_bt_search" runat="server" CausesValidation="False"
                                                Text="<%$ Resources:LanguageResource, Search %>" OnClick="btnSearch_Click" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                            <asp:GridView ID="grvPages" runat="server" AutoGenerateColumns="False" 
                                                DataKeyNames="PageID"
                                                EnableModelValidation="True" 
                                                OnPageIndexChanging="grvUser_PageIndexChanging"
                                                OnRowCommand="grvUser_RowCommand" 
                                                PageSize="20" AllowPaging="True">
                                                <Columns>
                                                    <asp:TemplateField HeaderText="<%$ Resources:LanguageResource, No %>">
                                                        <ItemTemplate>
                                                            <%# Container.DataItemIndex + 1 %>
                                                            <asp:Label ID="lblPageID" runat="server" Text='<%# Eval("PageID")%>' Visible="false"></asp:Label>
                                                        </ItemTemplate>
                                                        <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="<%$ Resources:LanguageResource, PageName %>">                                                    
                                                        <ItemTemplate>                                                            
                                                            <asp:Label ID="lblPageName" runat="server" Text='<%# Eval("PageName")%>'></asp:Label>
                                                        </ItemTemplate>
                                                        <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Url">                                                    
                                                        <ItemTemplate>
                                                            <%# Eval("PageURL")%>
                                                        </ItemTemplate>
                                                        <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                                    </asp:TemplateField>
                                            
                                                    <asp:TemplateField>
                                                        <ItemTemplate>
                                                            <asp:ImageButton ID="imgBtnChon" runat="server" CausesValidation="False" CommandName="chon"
                                                                Height="20px" ImageUrl="~/Images/check.png" CommandArgument='<%# Eval("PageID") %>'
                                                             />
                                                        </ItemTemplate>
                                                        <ControlStyle BackColor="White" BorderColor="White" />
                                                        <FooterStyle BackColor="White" BorderColor="White" />
                                                        <HeaderStyle BackColor="White" BorderColor="White" />
                                                        <ItemStyle BackColor="White" BorderColor="White" />
                                                    </asp:TemplateField>
                                                </Columns>
                                            </asp:GridView>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        </ContentTemplate>
                    </cc1:TabPanel>
                </cc1:tabcontainer>
    </ContentTemplate>
</asp:UpdatePanel>